import 'package:flutter/material.dart';

import 'package:get/get.dart';

import '../controllers/pass_login_controller.dart';
import '../../../../utils/screenAdapter.dart';
import '../../../../common/widget/logo.dart';
import '../../../../common/widget/userAgreement.dart';
import '../../../../common/widget/passTextField.dart';
import '../../../../common/widget/codeButton.dart';

class PassLoginView extends GetView<PassLoginController> {
  const PassLoginView({super.key});
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        actions: [
          Padding(
            padding: EdgeInsets.only(right: ScreenAdapter.width(20)),
            child: TextButton(
              onPressed: () {},
              child: Text(
                '帮助',
                style: TextStyle(
                  color: Colors.black54,
                ),
              ),
            ),
          ),
        ],
      ),
      body: ListView(
        padding: EdgeInsets.fromLTRB(
          ScreenAdapter.width(30),
          ScreenAdapter.height(100),
          ScreenAdapter.width(30),
          ScreenAdapter.height(30),
        ),
        children: [
          Logo(),
          SizedBox(height: ScreenAdapter.height(160)),
          PassTextField(
            controller: controller.usernameController,
            hintText: "请输入手机号码",
            onChanged: (value) {
              print("手机号码: $value");
            },
          ),
          SizedBox(height: ScreenAdapter.height(80)),
          PassTextField(
            controller: controller.passwordController,
            hintText: "请输入密码",
            onChanged: (value) {
              print("手机号码: $value");
            },
          ),
          SizedBox(height: ScreenAdapter.height(80)),
          UserAgreement(),
          SizedBox(height: ScreenAdapter.height(70)),
          CodeButton(
            textContent: "登录",
            onPressed: () {
              controller.goLogin();
            },
          ),
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              TextButton(
                onPressed: () {},
                child: Text("忘记密码", style: TextStyle(color: Colors.black54)),
              ),
              TextButton(
                onPressed: () {
                  // Get.offAndToNamed("/code-login-step-one");
                },
                child: Text("验证码登录", style: TextStyle(color: Colors.black54)),
              ),
            ],
          ),
        ],
      ),
    );
  }
}
